package com.example.patient.controller;

import com.alibaba.fastjson.JSONObject;
import com.example.common.support.Result;
import com.example.common.utils.RequestHelp;
import com.example.patient.service.MyOrderService;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@Api(tags = "我的订单")
@RequestMapping("/Shop/MyShopOrder")
public class MyShopOrderController {
    @Resource
    private MyOrderService myOrderService;

    @ApiOperation(value = "快递信息", notes = "快递信息")
    @PostMapping(value = "/OrderWaybill")
    public Result<Map<String, Object>> OrderWaybill(HttpServletRequest request) {
        JSONObject Jo = RequestHelp.GetFromBodyJson(request);
        String OrderNO = Jo.getString("OrderNO");
        return Result.success(myOrderService.OrderWaybill(OrderNO));
    }

    @ApiOperation(value = "确认收货", notes = "确认收货")
    @PostMapping(value = "/Receipt")
    public Result<String> Receipt(HttpServletRequest request) {
        JSONObject Jo = RequestHelp.GetFromBodyJson(request);
        String OrderNO = Jo.getString("OrderNO");
        return Result.success(myOrderService.Receipt(OrderNO));
    }
}
